using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.Xpo;
using TaiLieu;
namespace TaiLieu
{
    public class CodeSeoDB : Base
    {
        /// <summary>
        /// public static XPCollection<ContentManagement> GetAll()
        /// </summary>
        /// <returns>XPCollection<ContentManagement></returns>
        public static XPCollection<CodeSeo> GetAll(bool admin, string domain)
        {
            XPCollection<CodeSeo> _xp = new XPCollection<CodeSeo>(KetNoiCSDL.session);
            if (admin == false) _xp.Filter = DevExpress.Data.Filtering.CriteriaOperator.Parse("Active=true and web='" +maHoa.GetMD5HashData(domain )+ "'");
            else
                _xp.Filter = DevExpress.Data.Filtering.CriteriaOperator.Parse("web='" +maHoa.GetMD5HashData(domain )+ "'");
            return _xp;
        }
        /// <summary>
        /// public static ContentManagement GetObjectByid(int id)
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static CodeSeo GetObjectByid(int id, bool admin, string domain)
        {
            XPCollection<CodeSeo> _xpContentManagement = new XPCollection<CodeSeo>(KetNoiCSDL.session);
            _xpContentManagement.Filter = FilterAll(admin, domain);
            return _xpContentManagement.Lookup(id);
        }
    }
}
